home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-06 | 2.0 KB | 76 lines | [TEXT/GEOL] |
- Item 8905623 25-Oct-90 18:40PDT
-
- From: NEIL.RHODES Palomar SW, Neil Rhodes,PRT
-
- To: MACAPP.TECH$ MacApp Technical
- MACDTS Macintosh Developer Tech Supt
-
- Sub: Bug in DemoText MacApp sa
-
- Attn: Macapp Technichal mailing list
- Attn: Macintosh Tech Support
- SentBy: Neil Rhodes
- Date 10/25/90
- Subject Bug in DemoText MacApp samp
- From Neil Rhodes
- To Macapp Technichal mailing list
- CC Macintosh Tech Support
-
- Subject: Time:4:20 AM
- OFFICE MEMO Bug in DemoText MacApp sample Date:10/25/90
- In UTEDocument.inc1.p, the initilization method for TTEDocument is:
-
- procedure TTEDocument.ITEDocument (itsFileType, itsCreator: OSType;
- usesDataFork, usesRsrcFork: BOOLEAN; keepsDataOpen, keepsRsrcOpen: BOOLEAN);
-
- begin
- fDocText := nil;
- IDocument(itsFileType, itsCreator, usesDataFork, usesRsrcFork,
- keepsDataOpen, keepsRsrcOpen);
-
- fTEView := nil;
- fStyles := nil;
- fElements := nil;
- fDocText := NewPermHandle(0);
- FailNIL(fDocText);
- end;
-
- Unfortunately, this has a bug. Initilization methods are supposed to Free the
- object being initialized on a failure. In this initialization, if the
- NewPermHandle fails, then, the TTEDocument will not be freed (and therefore,
- no one will free it).
-
- The fix:
- Add a failure handler to free self.
-
- procedure TTEDocument.ITEDocument (itsFileType, itsCreator: OSType;
- usesDataFork, usesRsrcFork: BOOLEAN; keepsDataOpen, keepsRsrcOpen: BOOLEAN);
-
- var
- fi: FailInfo;
-
- procedure HandleITEDocumentFailure (err: OSErr; message: longint);
- begin
- self.Free;
- end;
-
- begin
- fDocText := nil;
- IDocument(itsFileType, itsCreator, usesDataFork, usesRsrcFork, keepsDataOpen,
- keepsRsrcOpen);
-
- fTEView := nil;
- fStyles := nil;
- fElements := nil;
- fDocText := NewPermHandle(0);
- CatchFailure(fi, HandleITEDocumentFailure);
- FailNIL(fDocText);
- Success(fi);
- end;
-
- Neil Rhodes
- Applelink Neil.Rhodes
- (619) 967-7285
-
-
-